<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
${aier_doctype}
<html <s:property value="aier_html_xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<title>${aier_title}</title>
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}ui.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/jq.css" />
<link rel="stylesheet" href="${aier_css_url}jc/chosen.css">
<link rel="stylesheet" href="${aier_css_url}social/module/jq-msg.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/reset.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/btn.css" />
<link rel="stylesheet"
	href="${aier_css_url}social/user/homeForums/common.css" />
<link rel="stylesheet" href="${aier_css_url}social/user/lookup.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/xxs.css" />

<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}${aier_jqui_js}ui.js"></script>
<script type="text/javascript" src="${aier_js_url}97/WdatePicker.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/cn.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/jq.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/ja.js"></script>
<script type="text/javascript" src="${aier_js_url}jc/cj.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/block.js"></script>

</head>
<body>
	-
	<!-- 顶栏 -->
	<s:action name="userhomecomm_homeHead" namespace="/user"
		executeResult="true"></s:action>

	<div class="window-content">

		<!-- wrap  -->

		<div class="wrap wrap-homepage wrap-tri-col hasgap clearfix">

			<s:action name="userhomecomm_homeLeft" namespace="/user"
				executeResult="true"></s:action>

			<!-- 主区域 (右  -->
			<div class="main-area clearfix">

				<!-- 中间栏 -->
				<div class="message-stream">
					<div class="stream-main">
						<div class="right-main-top">
							<div class="binfo-title" id="title">
								<h3>找学校</h3>
							</div>
							<div class="right-line"></div>
						</div>

						<div class="searchCondition" id="condition">
							<div class="s_byaddres s_byaddres_class">
								<div style="margin-bottom:40px;">学校所在地区：</div>
								<s:action name="citiesmap_cc" namespace="/common"
									executeResult="true"></s:action>
							</div>
							<div class="s_byaddres s_byaddres_class" style="margin-top: 20px">
								<div class="s-name-class">
									<label>学校名称：</label> <input id="fsName" type="text"
										class="PY-input"> <a id="fsBtn" href="javascript:;"
										class="button">搜索</a>
								</div>

							</div>

						</div>



						<p class="result" style="" id="pResult">
							
						</p>


						<div class="resultList" id="resultList">
							
						</div>
						
					</div>
					<div id = "page"></div>
				</div>

				<!-- 右栏 -->
				<s:action name="userhomecomm_homeRight" namespace="/user"
					executeResult="true"></s:action>


			</div>
			<!-- 返回顶部 -->
			<s:action name="userhomecomm_backToTop" namespace="/user" executeResult="true"></s:action>
			<!-- end 返回顶部 -->
		</div>
		<!-- footer copyright -->
		<s:action name="userhomecomm_homeFooter" namespace="/user" executeResult="true"></s:action>
		<!-- /footer copyright -->
	</div>
</body>
<script type="text/javascript">
	var page = 1;       // 当前页
    var page_size = 10; // 每页的记录数
	//搜索
    $("#fsBtn").click(function() {
        searchSchool(page);
    });
    
	function searchSchool(nowpage) {
	    page = nowpage;
        //区域id
	    var pid = $("#province").val();
	    var cid = $("#city").val();
	    var did = $("#area").val();
	    var sid = $("#street").val();
	    var areaId = sid != -1 ? sid : did != -1 ?did:cid!=-1?cid:pid;
	    
	    var sName = $("#fsName").val();
	    var fun=function(data){
            
            if(data.s==1){
                appendSchool(data.schoolList);
                // 更新分页显示
                page = data.page;
                toLoadPage(page, page_size, data.page_count, data.count, "page", "searchSchool", null, null); 
                if (data.count == 0) {
                    $("#page").css("display","none");
                } else {
                    $("#page").css("display","block");
                }
            } else {
                $().message("搜索失败，请稍后再试！");
            }
        };
        exeAjax(
             ajaxUrl("${aier_url}${aier_urijs}lookup_searchSchoolList${aier_suffix}"),
             fun,{
                 "page":page,
                 "page_size":page_size,
                 "sname":sName,
                 "scid":areaId
        });
		
	}
	
	function appendSchool(schoolList) {
	   var html = "";
	   if (schoolList != null && schoolList.length > 0) {
           $("#pResult").html('系统为您检索到 <span id="resultCount">'+schoolList.length+'<b>+</b> </span> 个结果');
           
           for (var i=0;i<schoolList.length;i++) {
               var school = schoolList[i];
               html += '<div class="attent clearfix"><a href="${aier_url}school/schoolhome_home${aier_suffix}?sid='+school.sid+'"><img alt='+school.name+' width="40" height="40" src="${schoollogo_get_url}small/'+school.slogo+'"></a><div>';
               html += '<a href="${aier_url}school/schoolhome_home${aier_suffix}?sid='+school.sid+'"><font style="color:#c00000;">'+school.name+'</font></a><p class="att">班级数&nbsp;<em>'+school.classCount+'</em></p><p></p></div></div>';
           }
           
       } else {
           $("#pResult").html('系统为您检索到 <span id="resultCount">0<b>+</b> </span> 个结果');
       }
       $("#resultList").html(html);
	}
	
	
</script>
</html>